<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./lib/vue-2.5.9.js"></script>
</head>

<body>
  <div id="app">
    <a href="http://www.baidu.com" @click.prevent="linkClick">去度娘</a>

    <form @submit.prevent="postForm">
      <input type="text" name="username">
      <input type="text" name="gender">
      <input type="submit" value="提交表单">
    </form>
  </div>

  <script>
    // 创建 Vue 实例，得到 ViewModel
    var vm = new Vue({
      el: '#app',
      data: {},
      methods: {
        linkClick() {
          console.log('按钮被点击了')
        },
        postForm() {
          console.log('触发了表单的submit事件')
        }
      }
    });
  </script>
</body>

</html>